﻿namespace Util
{
    public static class NumberHacking
    {
        public static int GetNumOnes(ulong val)
        {
            int res = 0;
            while (val != 0)
            {
                ++res;
                val &= val - 1;
            }
            return res;
        }
    }
}
